package cn.maidouya.hrm.properties;
import cn.maidouya.hrm.util.ValidUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component // 交给spring管理
@ConfigurationProperties(prefix = "oauth2.client") // 配置前缀
public class Oauth2ClientDetailsProperties {
    private Oauth2ClientDetails website; // oauth2/client/website/clientId和clientSecret/授权账号和授权密码
    private Oauth2ClientDetails admin; // oauth2/client/admin/clientId和clientSecret/授权账号和授权密码
    public Oauth2ClientDetails getClientDetials(Integer type) {
        // assertNotNull断言方法校验
        ValidUtils.assertNotNull(type, "类型不能为空");
        switch (type.intValue()){
            case 0: return admin;
            case 1: return website;
        }
        return null;
    }

    public Oauth2ClientDetails getWebsite() {
        return website;
    }

    public void setWebsite(Oauth2ClientDetails website) {
        this.website = website;
    }

    public Oauth2ClientDetails getAdmin() {
        return admin;
    }

    public void setAdmin(Oauth2ClientDetails admin) {
        this.admin = admin;
    }
}